home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / fgl110c.zip / 10-06.C < prev    next >
Text File  |  1992-01-31  |  953b  |  49 lines

  1. #include <fastgraf.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void main(void);
  6.  
  7. void main()
  8. {
  9.    int old_mode;
  10.    int hidden;
  11.    int x;
  12.  
  13.    /* initialize the video environment */
  14.  
  15.    if (fg_testmode(13,3) == 0) {
  16.       printf("This program requires EGA.\n");
  17.       exit(1);
  18.       }
  19.    old_mode = fg_getmode();
  20.    fg_setmode(13);
  21.  
  22.    /* draw the background on page two */
  23.  
  24.    fg_setpage(2);
  25.    fg_setcolor(1);
  26.    fg_rect(0,319,0,199);
  27.    fg_setcolor(15);
  28.    fg_move(160,100);
  29.    fg_ellipse(20,20);
  30.  
  31.    /* slide the object across the screen */
  32.  
  33.    hidden = 1;
  34.    fg_setcolor(10);
  35.    for (x = -10; x < 320; x+=4) {
  36.       fg_setpage(hidden);
  37.       fg_transfer(0,319,0,199,0,199,2,hidden);
  38.       fg_clprect(x,x+19,96,105);
  39.       fg_setvpage(hidden);
  40.       hidden = 1 - hidden;
  41.       fg_waitfor(1);
  42.       }
  43.  
  44.    /* restore the original video mode and return to DOS */
  45.  
  46.    fg_setmode(old_mode);
  47.    fg_reset();
  48. }
  49.